/*
 * @lc app=leetcode.cn id=232 lang=typescript
 *
 * [232] 用栈实现队列
 */

// @lc code=start
class MyQueue {
    private _stack: any = [];
    constructor() {
        this._stack = [];
    }

    push(x: number): void {
        this._stack.push(x);
    }

    pop(): number {
        const res = this.peek();
        this._stack.splice(0,1)
        return res
    }

    peek(): number {
        return this._stack[0]
    }

    empty(): boolean {
        return this._stack.length === 0
    }
}

/**
 * Your MyQueue object will be instantiated and called as such:
 * var obj = new MyQueue()
 * obj.push(x)
 * var param_2 = obj.pop()
 * var param_3 = obj.peek()
 * var param_4 = obj.empty()
 */
// @lc code=end

